package com.yowasa.xiuxian.engine.item.danyao;

import com.yowasa.xiuxian.annoations.Item;
import com.yowasa.xiuxian.engine.item.ItemInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ItemTypeEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.UserHelper;
import org.springframework.beans.factory.annotation.Autowired;

@Item(name = "金疮药", type = ItemTypeEnum.DAN_YAO, price = 5)
public class JinChuangYao implements ItemInterface {
    @Autowired
    private UserHelper userHelper;


    @Override
    public String desc() {
        return "回复至多1000点HP,商店可售";
    }

    @Override
    public String effect(UserBO userBO) {
        if (userBO.getUserBattle().getChp() >= userBO.getUserBattle().getHp()) {
            throw new HandlerException("你没有伤势,不需要使用金疮药");
        }
        int need = userBO.getUserBattle().getHp() - userBO.getUserBattle().getChp();
        String exMsg = "";
        if (need < 1000) {
            userBO.getUserBattle().setChp(userBO.getUserBattle().getHp());
            exMsg = ",你感觉你的身体已经完全回复了";
        }else {
            userBO.getUserBattle().setChp(userBO.getUserBattle().getChp()+1000);
        }
        return "回复了血量" + exMsg;

    }


}
